package com.x.erp.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.manage.InsuranceContractManage;
import com.x.erp.model.InsuranceContract;
import com.x.erp.rpc.InsuranceContractRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 延保商品服务
 */
@Component
@Service(interfaceName = "com.x.erp.rpc.InsuranceContractRpcService", timeout = 60000)
public class InsuranceContractService extends BaseService implements InsuranceContractRpcService {

	@Autowired
	private InsuranceContractManage insuranceContractManage;

	/**
	 * 新增延保合同
	 *
	 * @param insuranceContract
	 * @return
	 */
	@Override
	public InsuranceContract insertInsuranceContract(InsuranceContract insuranceContract, String orderId) {
		try {
			return insuranceContractManage.insertInsuranceContract(insuranceContract, orderId);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}
}
